package com.gitee.wsl.compose.ui.theme

import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import com.gitee.wsl.common.ui.theme.TypographyScheme
import com.gitee.wsl.common.ui.theme.defaultTypography
import com.gitee.wsl.compose.base.Local
import com.gitee.wsl.compose.ui.theme.color.lightColors


val LocalContentAlpha = compositionLocalOf { 1f }

//internal val LocalColors = staticCompositionLocalOf { lightColors() }

@get:Composable
val Local.contentAlpha get() = LocalContentAlpha.current

val LocalDimens = staticCompositionLocalOf { phoneDimensions() }

@get:Composable
val Local.dimens get() = LocalDimens.current

@Composable
fun ProvideTextStyle(value: TextStyle, content: @Composable () -> Unit) {
    val mergedStyle = LocalTextStyle.current.merge(value)
    CompositionLocalProvider(LocalTextStyle provides mergedStyle, content = content)
}

@Composable
fun getLocalTextStyle() = LocalTextStyle.current.copy(LocalContentColor.current.copy(alpha = LocalContentAlpha.current))

//val LocalTypography = staticCompositionLocalOf<TypographyScheme> {
//    defaultTypography
//    Typography(
//        caption = TextStyle(
//            fontWeight = FontWeight.Normal,
//            fontSize = 12.sp, lineHeight = 16.sp
//        ),
//        body = TextStyle(
//            fontWeight = FontWeight.Normal,
//            fontSize = 14.sp, lineHeight = 20.sp
//        ),
//        bodyStrong = TextStyle(
//            fontWeight = FontWeight.SemiBold,
//            fontSize = 14.sp, lineHeight = 20.sp
//        ),
//        bodyLarge = TextStyle(
//            fontWeight = FontWeight.Normal,
//            fontSize = 18.sp, lineHeight = 24.sp
//        ),
//        subtitle = TextStyle(
//            fontWeight = FontWeight.SemiBold,
//            fontSize = 20.sp, lineHeight = 28.sp
//        ),
//        title = TextStyle(
//            fontWeight = FontWeight.SemiBold,
//            fontSize = 28.sp, lineHeight = 36.sp
//        ),
//        titleLarge = TextStyle(
//            fontWeight = FontWeight.SemiBold,
//            fontSize = 40.sp, lineHeight = 52.sp
//        ),
//        display = TextStyle(
//            fontWeight = FontWeight.SemiBold,
//            fontSize = 68.sp, lineHeight = 92.sp
//        )
//    )
//}


/**
 * https://docs.microsoft.com/en-us/windows/apps/design/signature-experiences/typography
 */
//@Immutable
//class Typography(
//    val caption: TextStyle,
//    val body: TextStyle,
//    val bodyStrong: TextStyle,
//    val bodyLarge: TextStyle,
//    val subtitle: TextStyle,
//    val title: TextStyle,
//    val titleLarge: TextStyle,
//    val display: TextStyle
//)